import React, { Component } from 'react'
import './index.css'
import Item from '../Item'

export default class List extends Component {
    render() {
        //拿到父组件传递的任务列表 todos
        const { todos, changeDone } = this.props;
        return (
            <ul className='todo-main'>
                {
                    /* 
                    todos: [
                    { id: Date.now(), content: '抽烟', done: true },
                    { id: Date.now() + 1, content: '喝酒', done: true },
                    { id: Date.now() + 2, content: '烫头', done: true }
                    ]       
                    */
                    //todo:{ id: Date.now(), content: "抽烟", done: true },
                    todos.map((item, index) => {
                        return <Item key={item.id} {...item} changeDone={changeDone}/>
                    })
                }
            </ul>
        )
    }
}
